#include "timer.h"

namespace sleek
{
    namespace core
    {
        namespace math
        {
            timer::timer()
            {
                timestart = timestart = 0;
            }
            timer::~timer()
            {
            }
            void timer::update_begin()
            {
                timestamp = getTick();
            }
            void timer::update_end()
            {
                timestart = getTick();
            }
            long timer::getTimeMin()
            {
                return getTick();
            }
            long timer::getTimeSec()
            {
                return getTimeSec()/1000;
            }
            long timer::getTimeMsec()
            {
                return timestamp/CLOCKS_PER_SEC*1000;
            }
            long timer::getTime()
            {
                return getTimeMsec();
            }
            long timer::getElapsedTime()
            {
                return -difftime(timestart, timestamp)/CLOCKS_PER_SEC*1000;
            }
            long timer::getTick()
            {
                return clock();
            }
        }
    }
}
